package com.comtop.topcloud.device.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.comtop.topcloud.device.model.AlarmConfig;
import com.comtop.topcloud.device.model.mysql.EnergySystemAlarmLibrary;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface EnergySystemAlarmLibraryMapper extends BaseMapper<EnergySystemAlarmLibrary> {

    @Select("SELECT *  FROM energy_system_alarm_library esal " +
            "WHERE esal.device_type = #{deviceType} " +
            "AND esal.terminal_type =#{terminalType}")
    @Results({
            @Result(property = "energySystemAlarmConditions", column = "id",
                    many = @Many(select = "com.example.mapper.EnergySystemAlarmConditionsMapper.getConditionsByAlarmLibraryId"))
    })
    List<AlarmConfig> getAlarmConfigByDeviceTypeAndTerminalType(@Param("deviceType")String deviceType,@Param("terminalType")Integer terminalType);


}
